﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Blizzard.Contracts;
using Blizzard.Interceptors;

namespace Blizzard.Test.DataObjects
{

    [Mapper(Table = "bb")]
   public class BB : IDataObject
    {
        private Interceptor _interceptor;
        [Mapper(Field = "ID", IsIdentityColumn = true)]
        public int Id { get; set; }

        private string _name;
        [Mapper(Field = "Name")]
        public string Name
        {
            get
            {
                _interceptor.Intercept(this, "Name", false);
                return _name;
            }
            set
            {
                _interceptor.Intercept(this, "Name", true, _name, value);
                _name = value;
            }
        }


        


        private DateTime dateAdded;
        [Mapper(Field = "InsertionDate")]
        public DateTime DateAdded
        {
            get 
            {
                _interceptor.Intercept(this, "DateAdded", false);
                return dateAdded; 
            }
            set 
            {
                _interceptor.Intercept(this, "DateAdded", true, dateAdded, value);
                dateAdded = value; 
            }
        }

       

        private BList<B> bees;

        [Mapper(JoinTable = "b2b", MyIdField = "BBId")]
        public BList<B> Bees
        {
            get 
            {
                _interceptor.Intercept(this, "Bees", false);
                return bees; 
            }
            set 
            {
                _interceptor.Intercept(this, "Bees", true, bees, value);
                bees = value; 
            }
        }



       public Container.BlizzardManager Manager
       {
           set { _interceptor = new Interceptor(value); }
       }

    }
}
